# -*- coding: utf-8 -*-            
# @Author : HJH
# @Time : 2024/1/17 15:13
# @Use :
import datetime
import itertools
import json
import re
import string
import time

import execjs
import pandas as pd


def read_json():
    # 打开文件
    with open(r'D:\project\git\work\python-work\zsq\request.json', 'r') as file:
        # 读取文件内容
        data = file.read()

        # 解析 JSON 数据
        json_data = json.loads(data)

        # 输出 JSON 数据
        print(json_data)


def zuhe():
    # 定义要组合的字符串列表
    str = 'AAT/ACF/ACX/AEB/AHJ/AKA/AKU/ALA/AOG/AQG/AVA/AXF/BAR/BAV/BFJ/BHY/BPE/BPL/BPX/BSD/BZX/CAN/CBZ/CDE/CGD/CGO/CGQ/CHG/CIF/CIH/CJU/CKG/CNI/CQW/CSX/CTU/CWJ/CYI/CZX/DAT/DAX/DBC/DCY/DDG/DIG/DLC/DLU/DNH/DOY/DQA/DSN/DXJ/DYG/DZH/EHU/EJN/ENH/ENY/ERL/FOC/FUG/FUO/FYJ/FYN/GHN/GMQ/GNI/GOQ/GXH/GYS/GYU/GZG/HAK/HBQ/HCJ/HCN/HCZ/HDG/HEK/HET/HFE/HGH/HIA/HIN/HJJ/HKG/HLD/HLH/HMI/HNY/HPG/HQL/HQQ/HRB/HSC/HSN/HTN/HTT/HUN/HUO/HUZ/HXD/HYN/HZA/HZG/HZH/INC/IQM/IQN/JDZ/JGD/JGN/JGS/JHG/JIC/JIL/JIQ/JIU/JIX/JJN/JMJ/JMU/JNG/JNZ/JSJ/JUH/JUZ/JXA/JZH/KCA/KGT/KHG/KHH/KHN/KIX/KJH/KJI/KMG/KNC/KNH/KOW/KRL/KRY/KWE/KWL/KYD/LCX/LDS/LFQ/LHN/LHW/LIA/LJG/LLB/LLF/LLV/LNJ/LNL/LPF/LUM/LUZ/LXA/LXI/LYA/LYG/LYI/LZH/LZN/LZO/LZY/MDG/MFK/MFM/MIG/MXZ/MZG/NAO/NAY/NBS/NDG/NGB/NGO/NGQ/NKG/NLH/NLT/NNG/NNY/NTG/NZH/NZL/OHE/PEK/PIF/PKX/PVG/PZI/QSZ/RHT/RIZ/RKZ/RLK/RMQ/RQA/SHA/SHE/SHF/SHS/SJW/SQD/SQJ/SWA/SYM/SYX/SZV/SZX/TAO/TCG/TCZ/TEN/TFU/TGO/THQ/TLQ/TNA/TNH/TNN/TPE/TSA/TSN/TTT/TVS/TWC/TXG/TXN/TYN/UCB/URC/UYN/WDS/WEF/WEH/WGN/WHA/WHU/WMT/WNH/WNZ/WOT/WSK/WUA/WUH/WUS/WUT/WUX/WUZ/WXN/XAI/XEN/XFN/XIC/XIL/XIN/XIY/XMN/XNN/XNT/XUZ/YBP/YCU/YIC/YIE/YIH/YIN/YIW/YKH/YLN/YLX/YNJ/YNT/YNZ/YSQ/YTW/YTY/YUA/YUS/YYA/YZY/ZAT/ZFL/ZHA/ZHY/ZQZ/ZUH/ZYI'
    # str = 'AAT/ACF/ACX/AKA'
    # 使用 split() 方法切割字符串
    strings = str.split("/")

    # 定义组合的长度
    combination_length = 2

    # 使用 itertools.combinations 来生成所有组合
    combinations = itertools.combinations(strings, r=combination_length)

    # 将所有结果进行拼接
    result = [''.join(combination) for combination in combinations]

    # 创建 DataFrame 对象
    df = pd.DataFrame(result, columns=['航线'])

    # 将 DataFrame 数据写入 Excel 文件
    df.to_excel(r'D:\project\git\work\python-work\docs\全国航线.xlsx', index=False)

    # 打印结果
    # print(result)


def test_01():
    # 打开文件
    with open(r'../test/aa.js', 'r', encoding='utf-8') as file:
        # 读取文件内容
        data = file.read()

        # print(data)

        # 创建一个 JavaScript 环境
        ctx = execjs.compile(data)

        result = ctx.call("getAirlineData", 1)
        print(result)



if __name__ == '__main__':
    zuhe()
    # print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S:%f")[:-3])
    # print(int(datetime.datetime.now().timestamp() * 1000))
    # df1 = pd.read_excel(r'I:\下载\迅雷下载\销售明细报表20240124151721150701128543.xlsx')
    # df2 = pd.read_excel(r'I:\下载\迅雷下载\销售明细报表20240124151731100231536831.xlsx')
    # df3 = pd.read_excel(r'I:\下载\迅雷下载\销售明细报表20240124151749440575304620.xlsx')
    # df4 = pd.read_excel(r'I:\下载\迅雷下载\销售明细报表20240124151806815117088371.xlsx')
    # df5 = pd.read_excel(r'I:\下载\迅雷下载\销售明细报表20240124151817371481534126.xlsx')
    # df6 = pd.read_excel(r'I:\下载\迅雷下载\销售明细报表20240124151934761773614217.xlsx')
    # df7 = pd.read_excel(r'I:\下载\迅雷下载\销售明细报表20240124151942960341371070.xlsx')
    # df8 = pd.read_excel(r'I:\下载\迅雷下载\销售明细报表20240124151953140475304608.xlsx')
    #
    # # 使用 concat() 函数合并 DataFrame
    # output_df = pd.concat([df1, df2, df3, df4, df5, df6, df7, df8])
    #
    # output_df.to_excel(r'I:\下载\迅雷下载\销售明细报表.xlsx')
    # print(int(time.time() * 1000))
    # test_01()
    # print(int(''))
